unit UFrmSplash;

interface

uses
  Windows, Forms, SysUtils, DBIProcs, DBTables, Classes,
  IniFiles, Dialogs, Graphics, TitleBar, StdCtrls,
  Controls, ExtCtrls, Gauges;

type
  TFrmSplash = class(TForm)
    Timer1: TTimer;
    Image1: TImage;
    Gauge1: TGauge;
    Label1: TLabel;
    procedure Timer1Timer(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Conf(Path, Key, Value : String);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmSplash: TFrmSplash;

implementation

uses
   Funcaos, UFrmDialogo, Principal;
{$R *.DFM}

procedure TFrmSplash.Timer1Timer(Sender: TObject);
var i:integer;
begin
  Timer1.Enabled:=False;
  Label1.Caption:='Atualizando Arquivos do Sistema !';
  Gauge1.MinValue:=0;
  Gauge1.MaxValue:=100;
  for I := 1 to 100 do
   begin
      Gauge1.Progress:=i;  {atualiza barra de progressão}
      AguardaTempo(FrmSplash,25);
   end;
   close;
end;

procedure TFrmSplash.FormClose(Sender: TObject; var Action: TCloseAction);
begin
   Action := Cafree;
end;

procedure TFrmSplash.Conf(Path, Key, Value : String);
var
  ParamList: TParamList;
  Lista: TStringList;
  cfgMode: TConfigMode;
  i: Integer;
begin
  Lista := TStringList.Create;
  Session.GetConfigParams(Path, '', Lista);
  for i := 0 to Lista.Count - 1 do
  if Pos(UpperCase(Key), UpperCase(Lista[i])) <> 0 then
    Lista[i] := UpperCase(Key) + '=' + Value;
  cfgMode := Session.ConfigMode;
  Session.ConfigMode := cmPersistent;
  ParamList := TParamList.Create(Lista);
  Check(DbiCfgModifyRecord(nil, PChar(Path), ParamList.FieldCount,
  PFLDDesc(ParamList.FieldDescs), ParamList.Buffer));
  Session.ConfigMode := cfgMode;
  Session.SaveConfigFile;
  ParamList.Free;
  Lista.Free;
end;

end.
